<template>
  <el-select
    v-model="selectValue"
    placeholder="请选择"
    style="width:150px"
    clearable
    filterable
    :disabled="disabled"
    @change="changeEvent"
  >
    <el-option
      v-for="(item,index) in billTemplateTypeList"
      :key="index"
      :label="item.strreceipttypename"
      :value="item.lngreceipttypeid"
    />
  </el-select>
</template>
<script>
import { receipttypeList } from '@/api/system/bill-setting/bill-number-rules'
export default {
  name: 'BillTemplateTypeSelect',
  props: {
    value: {
      type: [Number, String],
      default: ''
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      billTemplateTypeList: []
    }
  },
  computed: {
    selectValue: {
      get() {
        return this.value
      },
      set(val) {
        this.$emit('input', val)
      }
    }
  },
  created() {
    this.receipttypeList()
  },
  methods: {
    changeEvent(val) {
      this.$emit('change', val)
    },
    receipttypeList() {
      receipttypeList().then(res => {
        if (res.code === 20000) {
          this.billTemplateTypeList = res.data
        }
      })
    }
  }
}
</script>
